Expression Solver



Just enter a math expression (with +, -, *, and / signs) and this script will evaluate the expression for you. Who needs a calculator when you have JavaScript. ;-) 
--------------------------------------------------------------------------------
 

<!-- TWO STEPS TO INSTALL EXPRESSION SOLVER:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function calc(form) {
form.result.value=eval(form.expr.value);
}
// End -->
</SCRIPT>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<center>
<i>Enter a math expression and click "Calculate" !</i>
<br>
<br>
<form>
<table border=3 cellspacing=2 cellpadding=5>
<tr>
<td align=center><i>Equation</i></td>
<td align=center><i>Result</i></td>
</tr>
<tr>
<td align=center><input type=text name=expr size=15></td>
<td align=center><input type=text name=result size=15></td>
</tr>
<tr>
<td colspan=2 align=center><input type=button value="Calculate!" onclick="calc(this.form)"></td>
</tr>
</table>
</form>
</center>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  1.09 KB -->